<%@page import="java.util.*, java.sql.*, javax.sql.DataSource, javax.naming.InitialContext, com.cpimex.eprice.action.plugin.ConnectionBuilder"%>
<%
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", -1); //prevents caching at the proxy server
%>
<%
	final String GRP = "id_grupo";	

	String str_grupo = request.getParameter(GRP);
	 
	String str_divisa = null;
	
	InitialContext context = new InitialContext();
	//DataSource dataSrc = (DataSource) context.lookup("java:comp/env/jdbc/Eprice");
	Connection conn = ConnectionBuilder.epriceConnection(context);
	Statement stmt = conn.createStatement();
	
	try{
		String  str_query = 
			" SELECT top 1 moneda_cli                                             " +
			" FROM ep_vw_cliente WHERE (grupo_cli <> ''                           " +
			"      AND grupo_cli is not null                                      " +
			"      AND grupo_cli = "		+(str_grupo==null?"000":str_grupo)+")     " +
			" ORDER BY GRUPO_CLI, codigo_cli                                      ";
		
		ResultSet rs = stmt.executeQuery(str_query);
		
		if(rs.next()){
			str_divisa =  rs.getString("moneda_cli");
		}
		out.println(str_divisa);
	}catch(Exception ex){
		ex.printStackTrace();
	}finally{
		conn.close();
	}

%>